#ifndef __BEV_NET_H__
#define __BEV_NET_H__

#include <stdio.h>
#include <string.h>

#include "amba_net.h"
#include "common/data_type.h"

class BevNet : public AmbaNet {
 public:
  enum InputType : std::uint8_t {
    CAT2491 = 3,
    CAT2492 = 1,
    RING_MATRIX = 5,
    RAY_MATRIX = 2,
    LIDAR_INPUT = 0,
    GRID_SAMPLE = 4,
    Count = 6
  };

  BevNet() noexcept;
  ~BevNet();

  BevNet(BevNet const &) = delete;
  BevNet(BevNet const &&) = delete;
  BevNet &operator=(BevNet const &) = delete;
  BevNet &operator=(BevNet const &&) = delete;

  bool SetInput(std::string const &path, InputType input_type) noexcept;
  bool SetInput(char *input_buffer, std::uint32_t buffer_size,
                InputType input_type) noexcept;

  uint32_t Run(DataBuf& data_frame) noexcept;
  void test();
  static constexpr std::uint8_t kImageNum{6};
  // 264 * 59 * 2:--- 264 * 128
  static constexpr std::uint32_t kCat2491{264 * 128};
  // 264 * 80 * 2 -----264 * 256
  static constexpr std::uint32_t kCat2492{264 * 256};

  static constexpr std::uint32_t kGridSampleResSize{256 * 128 * 128 * 2};

 private:
  struct ImageOutbuffer {
    char *cat2491;
    char *cat2492;
  };

  std::uint32_t free_all_buffer();
  // memory blocks
  flexidag_memblk_t cat2491;
  flexidag_memblk_t cat2492;
  flexidag_memblk_t lidar_input;
  flexidag_memblk_t ray_matrix;
  flexidag_memblk_t grid_sample_result;
  flexidag_memblk_t ring_matrix;

  flexidag_memblk_t inputblk_[InputType::Count];
};

#endif